import { Request, SupplierRequest } from '@/plugins/supplier-request'
import { AUDIT_LOG_PATH, COMPONENT_PATH, LIST_COLUMN_SETTINGS_PATH } from './constans'

// 供应商管理 - 审批日志查询
export const queryAuditLogListService = (data) => {
  return Request(`${AUDIT_LOG_PATH}/page`, 'post', data)
}

// 调用启信宝，获取公司信息
export function getQiXinBaoCompanyInfo (data) {
  return Request(`${COMPONENT_PATH}/company/info`, 'get', data)
}

// 供应商类型转化前置校验
export function supplierPreConvertCheck (data) {
  return Request(`${COMPONENT_PATH}/supplier-check`, 'get', data)
}

// 供应商人员信息添加行选择直属上级
export function getSupplierDirectSuperior (data) {
  return Request(`${COMPONENT_PATH}/supplier-person`, 'post', data)
}

// 通过城市级别和父级编码查询所有地址
export function getAddressList (data) {
  return Request(`${COMPONENT_PATH}/address/getAddressList`, 'post', data)
}

// 通过字典ids获取字典项列表
export function getItemsByDictIds (data) {
  return Request(`${COMPONENT_PATH}/dict/getItemsByDictIds`, 'post', data)
}
// 通过主数据字典ids获取对应值
export function getSysTypeIds (data) {
  return Request(`${COMPONENT_PATH}/dict/getSysTypeIds`, 'get', data)
}
// 获取资质菜单列表
export function getSupplierQualificationMenu (data) {
  return Request(`${COMPONENT_PATH}/supplier-qualification-menu`, 'post', data)
}
// 查询支行档案信息
export function getBankDocList (data) {
  return Request(`${COMPONENT_PATH}/getBankDocList`, 'post', data)
}
// 通过供应商ID查询操作记录
export function getChangeLogListBySupplierId (data) {
  return Request(`${COMPONENT_PATH}/supplierId`, 'post', data)
}
// 分页查询品牌信息
export function queryBrandList (data) {
  return Request(`${COMPONENT_PATH}/category/getBrandPager`, 'post', data)
}
// 查询供应商主要业务联系人
export function getMainBusinessContact (data) {
  return Request(`${COMPONENT_PATH}/supplier/main-business-contact`, 'get', data)
}
// 查询分公司信息
export function getPureSonCompanyList (data) {
  return Request(`${COMPONENT_PATH}/getPureSonCompanyList`, 'post', data)
}
// 获取主数据部门集合
export function getDepartmentList (data) {
  return Request(`${COMPONENT_PATH}/getDepartmentList`, 'post', data)
}
// 获取主数据销售区域信息
export function getSaleAreaList (data) {
  return Request(`${COMPONENT_PATH}/getAreaList`, 'post', data)
}

// 查询列表表头设置接口
export function getListColumnSettings (data) {
  return Request(`${LIST_COLUMN_SETTINGS_PATH}/query`, 'post', data)
}

// 更新列表表头设置信息接口
export function updateListColumnSettings (data) {
  return Request(`${LIST_COLUMN_SETTINGS_PATH}/update`, 'post', data)
}

// 获取供应商信息
export const querySupplierInfoService = (data) => {
  return Request('component/supplier/query', 'post', data)
}
// 批量获取供应商信息
export const batchQuerySupplierInfoService = (data) => {
  return Request('component/supplier/batch-query', 'post', data)
}
// 获取供应商车队信息
export const queryFleetInfoService = (data) => {
  return Request('component/fleet/query', 'post', data)
}
// 获取来访人员信息
export const querySupplierPersonInfoService = (data) => {
  // return Request('component/supplier-person/query', 'post', data)
  return Request('component/supplier-person/all', 'post', data)
}
// 获取管理区域
export const queryManageAreaService = (data) => {
  return Request('component/manage-area', 'get', data)
}
// 获取用户中心人员
export const queryHrUserService = (data) => {
  return Request('component/hr-user/query', 'post', data)
}
// 获取计量单位
export const queryUnitService = (data) => {
  return Request('component/unit/queryByNamePage', 'post', data)
}
// 获取字典项列表
export const queryItemsByDictIdService = (data) => {
  return Request('component/dict/getItemsByDictId', 'get', data)
}
// 获取字典项列表（多id查询）
export const queryItemsByDictIdsService = (data) => {
  return Request('component/dict/getItemsByDictIds', 'post', data)
}
// 获取字典项列表 主数据接口
export const querySysTypeByDictIdService = (data) => {
  return Request('component/dict/getSysTypeId', 'get', data)
}
// 获取字典项列表（多id查询）主数据接口
export const querySysTypeByDictIdsService = (data) => {
  return Request('component/dict/getSysTypeIds', 'get', data)
}
// 获取省市区
export const queryAddressListService = (data) => {
  return Request('component/address/getAddressList', 'post', data)
}
// 根据等级获取品类集合
export const queryCategoryListService = data => Request(
  'component/category/getAllProductCategoryByPage', 'post', data
)
// 获取四级类全路径品类集合
export const queryLevel4CategoryPathListService = data => Request(
  'component/category/getLevel4AllPath', 'post', data
)
// 获取本品类数据权限
export const queryPermissionService = data => Request(
  'permission/getDataPermission', 'get', data
)
// 获取本品类数据权限
export const queryTodoTypeservice = data => Request(
  'component/subsequent-backlog', 'get', data
)
// 原材料信息 - 获取核心原材料
export const queryCoreRawMaterialService = (data, loadingFn) => SupplierRequest({
  url: '/component/rawMat/getMatInfo4Sup',
  type: 'post',
  data,
  loadingFn
});
// 开户行
export const validateInvoiceSupplierService = (data, loadingFn) => SupplierRequest({
  url: '/component/validateInvoiceSupplier',
  type: 'get',
  data,
  loadingFn,
});

// 获取物流中心
export const queryLogisticsCenterService = (data, loadingFn) => SupplierRequest({
  url: '/component/getMaterialList',
  type: 'get',
  data,
  loadingFn,
});

// 获取企业信息类型
export const queryEnterpriseTypeService = (data, loadingFn) => SupplierRequest({
  url: '/qiXinBao/config/list',
  type: 'get',
  data,
  loadingFn,
});

// 获取企业信息列表
export const queryEnterpriseInfoListService = (data, loadingFn) => SupplierRequest({
  url: '/qiXinBao/company/infoList',
  type: 'post',
  data,
  loadingFn,
});
